﻿<%@ page language="java" import="com.newcrm.config.Const,com.newcrm.util.Util,com.newcrm.bean.*,java.util.List,java.util.Map" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
  List<Map<String, Object>> customerfield = (List<Map<String, Object>>)request.getAttribute("customerfield");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>客户自定义字段管理</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="renderer" content="webkit"/>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/qikebao.ico" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/all.css?ver=<%=Const.VERSION%>">
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/datepicker.css" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap-datetimepicker.min.css" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/magnific-popup.css">
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery-1.11.1.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery-ui.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.bootstrap-growl.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/moment.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap-datepicker.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap-datetimepicker.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/daterangepicker.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.magnific-popup.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.cookie.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/popbox.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/common.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/customerFields.js?ver=<%=Const.VERSION%>"></script>
  <script>
    var field_type_select = '<%=Const.FIELD_TYPE_SELECT%>';
    var field_type_checkbox = '<%=Const.FIELD_TYPE_CHECKBOX%>';
  </script>
</head>
<body class="parties">
  <jsp:include page="topNavi.jsp" flush="true"/>
  <div class="main-page">
    <table>
    <tr>
      <td class="main-body">
        <div class="topnavi">
          <div class='leftMenu'><span>客户自定义字段管理</span></div>
        </div>
        <div class="grid">
          <div class="new_field_menu">
            <span class="popbox">
              <a class="button green open" href="#"><i class="fa fa-plus"></i> 添加客户自定义字段</a>
              <div class='collapse'>
                <div class='box'>
                  <div class='arrow'></div><div class='arrow-border'></div>
                  <form id="form_field">
                  <div class="box_field">
                    <h3>添加自定义字段</h3>
                    <p class="field_body">
                      <input id="customer_field_name" size="25" type="text" />
                    </p>
                    <h5>适用对象</h5>
                    <p>
                      <select id="customer_field_type">
                      <option value="0">针对公司和联系人</option>
                      <option value="1">仅针对公司</option>
                      <option value="2">仅针对联系人</option>
                      </select>
                    </p>
                    <h5>数据类型</h5>
                    <p>
                      <select class="field_type_sel" id="customer_value_type">
                      <option value="0">文本</option>
                      <option value="1">数字</option>
                      <option value="2">日期</option>
                      <option value="3">单选</option>
                      <option value="4">复选</option>
                      </select>
                    </p>
                    <div class="initValueDiv">
                    <h5>选择内容（针对单项和复选的情况）</h5>
                    <input class="autofocus focusinput" title="用逗号分割 如:选项一,选项二" value="用逗号分割 如:选项一,选项二" id="customer_initValue" size="25" type="text" />
                    </div>
                  </div>
                  <div class="submit">
                    <a id="add_field_button" class="button blue small closePopbox" href="#"><i class="fa fa-check"></i> 添加字段</a>
                    &nbsp;&nbsp;<a href="#" class="closePopbox">取消</a>
                  </div>
                  </form>
                </div>
              </div>
            </span>
          </div>
          <ul class="items ui-sortable" id="itemlist">
            <%if (customerfield != null) {
                for (Map<String, Object> filed:customerfield) {
                  String tmp = "";
                  int fieldType = ((Integer)filed.get("FieldType")).intValue();
                  if (Const.CUSTOMER_FIELD_TYPE_ALL == fieldType) {
                    tmp = "(针对公司和联系人)";
                  } else if (Const.CUSTOMER_FIELD_TYPE_COMPANY == fieldType) {
                    tmp = "(仅针对公司)";
                  } else {
                    tmp = "(仅针对联系人)";
                  }
                %>
            <li class="item" id="ID_<%=filed.get("CustomerFieldId")%>">
              <div class="show">
                <div class="name">
                  <strong class="label"><%=Util.HTMLEncode((String)filed.get("CustomerFieldName"))%></strong> <span><%=tmp%></span>
                </div>
                <ul class="controls">
                  <input type="hidden" name="fieldName" value="<%=Util.HTMLEncode((String)filed.get("CustomerFieldName"))%>">
                  <input type="hidden" name="fieldType" value="<%=filed.get("FieldType")%>">
                  <input type="hidden" name="valueType" value="<%=filed.get("ValueType")%>">
                  <input type="hidden" name="initValue" value="<%=Util.HTMLEncode((String)filed.get("InitValue"))%>">
                  <li><a class="update" href="<%=filed.get("CustomerFieldId")%>">修改</a></li>
                  <li><a title="删除自定义字段" class="delete" href="<%=filed.get("CustomerFieldId")%>"><i class="fa fa-trash-o"></i> &nbsp;</a></li>
                </ul>
              </div>
            </li>
            <%
              }
            }
            %>
          </ul>
        </div>
      </td>
      <td class="main-sidebar">
        <div class="content">
          <div class="liner">
            <div class="sidebox closedbox">
              <h5>自定义字段</h5>
              <p>系统中提供了丰富的自定义字段支持。<br/><br/></p>
              <p>可以分别给公司和联系人，设置自定义字段。<br/><br/></p>
              <p>同时也可以设置自定义字段的类型，比如，文本，日期，数字等。</p>
            </div>
          </div>
        </div>
      </td>
    </tr>
    </table>
  </div>

  <div class="show" id="clone" style="display:none;">
    <div class="name">
      <strong class="label"></strong> <span></span>
    </div>
    <ul class="controls">
      <input type="hidden" name="fieldName" value="">
      <input type="hidden" name="fieldType" value="">
      <input type="hidden" name="valueType" value="">
      <input type="hidden" name="initValue" value="">
      <li><a class="update" href="#">修改</a></li>
      <li><a title="删除自定义字段" class="delete" href=""><i class="fa fa-trash-o"></i> &nbsp;</a></li>
    </ul>
  </div>


  <div class='movebox' id="box_update_field">
    <div class='arrow'></div><div class='arrow-border'></div>
    <form id="update_form_field">
    <input type="hidden" id="update_customer_field_id" value="">
    <div class="box_field">
      <h3>修改自定义字段</h3>
      <p class="field_body">
        <input id="update_customer_field_name" size="25" type="text" />
      </p>
      <h5>适用对象</h5>
      <p>
        <select id="update_customer_field_type">
        <option value="0">针对公司和联系人</option>
        <option value="1">仅针对公司</option>
        <option value="2">仅针对联系人</option>
        </select>
      </p>
      <h5>数据类型</h5>
      <p>
        <select class="field_type_sel" id="update_customer_value_type">
        <option value="0">文本</option>
        <option value="1">数字</option>
        <option value="2">日期</option>
        <option value="3">单选</option>
        <option value="4">复选</option>
        </select>
      </p>
      <div class="initValueDiv">
      <h5>选择内容（针对单项和复选的情况）</h5>
      <input class="autofocus focusinput" title="用逗号分割 如:选项一,选项二" value="用逗号分割 如:选项一,选项二" id="update_customer_initValue" size="25" type="text" />
      </div>
    </div>
    <div class="submit">
      <a id="update_field_button" class="button blue small closePopbox" href="#"><i class="fa fa-check"></i> 修改字段</a>
      &nbsp;&nbsp;<a href="#" class="closePopbox" id="update_field_cancel_link">取消</a>
    </div>
    </form>
  </div>

</body>
</html>